{{- define "azure_cloud_config" }}
{
    "cloud": "AzurePublicCloud",
    "tenantId": {{ .Values.cloudProviderAzure.internal.providerClusterConfiguration.provider.tenantId | quote }},
    "aadClientId": {{ .Values.cloudProviderAzure.internal.providerClusterConfiguration.provider.clientId | quote }},
    "aadClientSecret": {{ .Values.cloudProviderAzure.internal.providerClusterConfiguration.provider.clientSecret | quote }},
    "subscriptionId": {{ .Values.cloudProviderAzure.internal.providerClusterConfiguration.provider.subscriptionId | quote }},
    "location": {{ .Values.cloudProviderAzure.internal.providerClusterConfiguration.provider.location | quote }},
    "resourceGroup": {{ .Values.cloudProviderAzure.internal.providerDiscoveryData.resourceGroupName | quote }},
    "securityGroupName": {{ .Values.global.clusterConfiguration.cloud.prefix | quote }},
    "routeTableName": {{ .Values.global.clusterConfiguration.cloud.prefix | quote }},
    "vnetName": {{ .Values.cloudProviderAzure.internal.providerDiscoveryData.vnetName | quote }},
    "subnetName": {{ .Values.cloudProviderAzure.internal.providerDiscoveryData.subnetName | quote }},
    "useInstanceMetadata": true,
    "loadBalancerSku": "standard"
}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
  name: cloud-controller-manager
  namespace: d8-cloud-provider-azure
  {{- include "helm_lib_module_labels" (list . (dict "app" "cloud-controller-manager")) | nindent 2 }}
type: Opaque
data:
  cloud-config: {{ include "azure_cloud_config" . | b64enc | quote }}
